:root {
  --bg: #FAFAFA;
  /* Paper White */
  --ink: #111111;
  /* Deep Black */
  --muted: #666666;
  --card: #FFFFFF;
  --edge: #E5E5E5;
  --acc: #E60023;
  /* Editorial Red */
  --bad: #ff3333;
  --ok: #008f39;

  --font-heading: 'Syne', sans-serif;
  --font-body: 'Manrope', sans-serif;

  --tab-active-background: var(--ink);
  --tab-active-text: #FFFFFF;
  --tab-inactive-background: #F0F0F0;
  --tab-inactive-text: var(--muted);

  /* bottom sheet sizing */
  --tray-open-h: 68vh;
}


* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 var(--font-body);
  letter-spacing: -0.01em;
  /* stop scroll chaining / iOS pull-to-refresh from inner scrollers */
  overscroll-behavior-y: none;
}

/* While dragging: prevent selection and hint grabbing */
body.dragging,
body.dragging * {
  -webkit-user-select: none !important;
  user-select: none !important;
}

body.dragging .mcard {
  cursor: grabbing;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 20px 24px;
  border-bottom: 1px solid var(--edge);
  background: rgba(250, 250, 250, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--ink);
}

main {
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 58px)
}

.altar {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 2px;
  border: 1px solid var(--edge);
  background: var(--card);
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ghost {
  opacity: .85
}

.altarBoard {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  border-radius: 2px;
  transition: box-shadow .15s ease, outline-color .15s ease;
  position: relative;
}

.altarBoard[data-dragging="true"] {
  outline: 1px dashed var(--acc);
  outline-offset: 4px;
  box-shadow: 0 0 0 1px rgba(204, 255, 0, 0.2) inset;
  background: rgba(204, 255, 0, 0.05);
}

/* Drop target highlight when dragging over */
.altarBoard.drop-target {
  outline: 2px solid var(--acc);
  outline-offset: 4px;
  background: rgba(204, 255, 0, 0.15);
  box-shadow: 0 0 20px rgba(204, 255, 0, 0.3) inset;
}

/* Altar generating state - visual feedback that inspos are locked */
.altarBoard.generating {
  pointer-events: none;
  opacity: 0.7;
}

.altarBoard.generating .altar-slot {
  filter: grayscale(0.3);
}

.altarBoard.generating .mcard {
  cursor: not-allowed;
}

.sheet.drop-target {
  box-shadow: 0 -4px 20px rgba(204, 255, 0, 0.3);
  border-top-color: var(--acc);
}

/* Tray dragging state (when dragging from altar back to tray) */
.sheet[data-dragging="true"],
#trayInv[data-dragging="true"] {
  box-shadow: 0 -2px 10px rgba(204, 255, 0, 0.2);
}

/* Legacy Altar Slots - TO BE REMOVED IF CONFIRMED UNUSED */
/* .slot, .slotHeader, .slotBody are not used in current app.js rendering */

.slot[data-hot="true"] {
  outline: 2px solid #4b7bec
}

/* User Area & Auth */
.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Responsive header for small screens */
@media (max-width: 520px) {
  header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }

  header h1 {
    font-size: 16px;
    flex: 1;
    min-width: 0;
  }

  .user-area {
    gap: 6px;
  }

  .user-name {
    display: none;
  }

  .avatar-preview {
    width: 28px;
    height: 28px;
  }

  .auth-btn {
    padding: 4px 10px !important;
    font-size: 12px !important;
  }
}

.avatar-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-preview {
  width: 32px;
  height: 32px;
  border-radius: 2px;
  background: var(--edge);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--edge);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 18px;
}

#avatar-upload {
  display: none;
}

.user-name {
  font-weight: 700;
  color: var(--ink);
}

.auth-btn {
  padding: 6px 12px !important;
  font-size: 13px !important;
  box-shadow: none !important;
  border-width: 1px !important;
}

/* Credits Badge */
.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 2px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.credits-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tagbox {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1/1;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 4px;
}

.tagbox span {
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--muted);
  font-family: var(--font-heading);
}

.thumb {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
  background: #0a0b10;
  border: 0;
  border-radius: 0;
}

.altarBoard .thumb {
  border: 0px;
  max-width: 240px;
}

.capText {
  font-weight: 700
}

.removeBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 700
}

.removeBtn small {
  opacity: .9
}

.actionWrap {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.craftBtn {
  border-radius: 0px;
  padding: 14px 24px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 0;
  background: var(--acc);
  color: #FFFFFF;
  box-shadow: none;
  transition: all .2s ease;
  cursor: pointer;
}

.craftBtn:hover {
  transform: translateY(-2px);
  background: #000;
}

.craftBtn[hidden] {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(.98)
}

@keyframes slotNudge {
  0% {
    transform: translate(calc(var(--nX)*-0.05), calc(var(--nY)*-0.05));
    opacity: .8
  }

  50% {
    transform: translate(calc(var(--nX)*0.05), calc(var(--nY)*0.05));
    opacity: .8
  }

  100% {
    transform: translate(calc(var(--nX)*-0.05), calc(var(--nY)*-0.05));
    opacity: .8
  }
}

.slot[data-craft="active"] .thumb,
.slot[data-craft="active"] .tagbox,
.slot[data-craft="active"] .capText {
  animation: slotNudge .9s ease-in-out infinite;
  will-change: transform, opacity
}

.slot[data-craft="active"] .slotHeader {
  display: none;
}

/* Altar Content (New Structure) */
.altar-instructions {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.instr-title {
  font-size: 14px;
  margin-bottom: 10px;
}

.instr-subtitle {
  font-size: 12px;
  opacity: 0.7;
}

.altar-slot {
  min-height: 80px;
  border: 2px dashed var(--edge);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  margin: 8px;
}

.altar-inspo {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 2px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.altar-inspo:hover {
  background: rgba(255, 255, 255, 0.1);
}

.altar-inspo .remove {
  opacity: 0.5;
  font-size: 12px;
}

.altar-inspo:hover .remove {
  opacity: 1;
}

.inspo-thumb-wrapper {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inspo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.inspo-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
}

/* Specific Pill Colors */
.pill.vibe {
  background: rgba(255, 107, 107, 0.2);
  border-color: #ff6b6b;
}

.pill.texture {
  background: rgba(78, 205, 196, 0.2);
  border-color: #4ecdc4;
}

.pill.era {
  background: rgba(255, 230, 109, 0.2);
  border-color: #ffe66d;
}

.pill.nature {
  background: rgba(149, 225, 211, 0.2);
  border-color: #95e1d3;
}

.pill.art {
  background: rgba(199, 125, 255, 0.2);
  border-color: #c77dff;
}

.pill.architecture {
  background: rgba(248, 177, 149, 0.2);
  border-color: #f8b195;
}

.spawnCard .cap {
  padding: 8px;
  font-weight: 800
}

/* Legacy spawnCard - UNUSED in app.js */

.mcard {
  background: var(--card);
  border-radius: 0px;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: default;
  border: 1px solid var(--edge);
  transition: border-color 0.2s ease;
  /* Anchor tag reset for <a class="mcard"> */
  display: block;
  text-decoration: none;
  color: inherit;
}

.mcard:hover {
  border-color: var(--ink);
}

.mcard img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: #0a0b10;
  pointer-events: none;
  -webkit-user-drag: none
}

.mcard.held {
  filter: saturate(.3) brightness(.9);
  opacity: .6;
  pointer-events: none
}

.mcap {
  padding: 8px
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px
}

.seeBtn {
  border-radius: 10px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 700;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer
}

/* Bottom Tray */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tray-open-h);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--edge);
  backdrop-filter: blur(16px);
  z-index: 50;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 10px);
}

.sheetBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 6px 2px;
  position: relative;
}

.tabs {
  display: flex;
  gap: 8px;
  padding-top: 10px
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 2px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab .count {
  opacity: .9
}

.tab.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.chev {
  --size: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 2px;
  border: 1px solid var(--edge);
  background: var(--card);
  color: var(--muted);
  font-weight: 900;
  font-size: 14px;
  font-family: var(--font-heading);
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  z-index: 5;
}

.chev:active {
  transform: translateY(1px);
}

.filters {
  display: none;
  gap: 8px;
  padding: 6px 2px 8px 2px;
  flex-wrap: wrap
}

.filters.on {
  display: flex
}

.chip {
  padding: 6px 12px;
  border-radius: 2px;
  border: 1px solid var(--edge);
  background: var(--card);
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip {
  padding: 8px 16px;
  border-radius: 0px;
  border: 1px solid var(--edge);
  background: #FFFFFF;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip.active {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

.trayBody {
  overflow: auto;
  height: calc(100% - 64px);
  padding-top: 2px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.trayPage {
  display: none
}

.trayPage.on {
  display: block
}

.gridTray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-bottom: 20vh;
}

/* Explicitly revert "Fits" tab (Access Closet) to 2 cols on mobile, 3 on desktop */
#trayClosetGrid {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width:760px) {
  .gridTray {
    grid-template-columns: repeat(4, 1fr)
  }

  /* Fits grid desktop override */
  #trayClosetGrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dragGhost {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  width: 140px;
  z-index: 1000;
  pointer-events: none;
  opacity: .95;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .45));
  transition: opacity .08s linear
}

.dragGhost .gcard {
  background: var(--card);
  border-radius: 2px;
  overflow: hidden
}

.dragGhost img {
  width: 100%;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: #0a0b10;
  display: block
}

.dragGhost .pad {
  padding: 6px
}

.dragGhost .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #cbd5e1
}

.dragGhost .badge {
  border: 1px solid var(--edge);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  color: #cbd5e1;
  background: #1a1b22
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px) saturate(1.1);
  z-index: 800;
  padding: 56px 24px 24px;
}

.modal.on {
  display: flex
}

.panel {
  width: 100%;
  max-width: 1100px;
  height: 85vh;
  max-height: 800px;
  overflow-y: auto;
  background: #FFFFFF;
  border-radius: 0;
  border: 1px solid var(--edge);
  box-shadow: none;
  display: flex;
  flex-direction: row;
  position: relative;
}

/* Responsive Panel */
@media (max-width: 768px) {
  .panel {
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: 0;
  }
}

/* Full Card Layout */
.fullCard {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

@media (max-width: 768px) {
  .fullCard {
    flex-direction: column;
    overflow-y: auto;
  }
}

/* Full Content Container (scrollable right pane) */
.full {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 768px) {
  .full {
    padding: 20px;
  }
}

.cardHero {
  flex: 0 0 50%;
  position: relative;
  border-radius: 0;
  overflow: hidden;
  background: #F4F4F4;
  min-height: 300px;
}

@media (max-width: 768px) {
  .cardHero {
    flex: 0 0 auto;
    width: 100%;
    max-height: 50vh;
  }
}

.cardHero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.heroMeta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
  color: #FFFFFF;
}

/* Override pill in heroMeta to be visible on gradient */
.heroMeta .pill {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

/* Close button in top-right corner of modal panel */
.panel .modalClose {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 810;
  background: #FFFFFF;
  border: 1px solid var(--edge);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  font-size: 16px;
  transition: all 0.2s ease;
  /* Anchor tag reset */
  text-decoration: none;
}

.panel .modalClose:hover {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

.heroTitle {
  display: grid;
  gap: 6px;
}

.heroTitle .name {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #FFFFFF;
}

.heroTitle .epi {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-body);
  font-style: italic;
}

.fullSection {
  padding: 20px;
  background: #F8F8F8;
  border-radius: 2px;
}

.fullSection h4 {
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  font-family: var(--font-body);
  font-weight: 700;
}

.kvGrid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.kv {
  display: grid;
  gap: 4px;
}

.kv .k {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-body);
}

.kv .v {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  font-family: var(--font-body);
}

.statRow {
  display: grid;
  gap: 8px;
}

.statChip {
  display: grid;
  gap: 4px;
}

.statChip .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
}

.statChip .bar {
  width: 100%;
  height: 4px;
  border-radius: 0;
  background: #EEE;
  border: 0;
  overflow: hidden;
}

.statChip .bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--ink);
}

.tagWrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tagWrap .pill {
  background: #F8F8F8;
  border: 1px solid var(--edge);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 11px;
  padding: 6px 10px;
}

/* Allow pill text in kvGrid to wrap onto multiple lines */
.kvGrid .kv .tagWrap .pill {
  white-space: normal;
  word-break: break-word;
}



.modal .panel {
  -webkit-overflow-scrolling: touch;
}

.modal .mcard,
.modal .mcard img,
.modal .fullCard,
.modal .lineageStrip {
  touch-action: pan-y;
}

.mcard.mini .mcap .row .seeBtn {
  display: none;
}

.full {
  padding: 14px
}

.fullHeader {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(23, 26, 36, .9), rgba(16, 19, 28, .9))
}

.fullHeader .name {
  font-size: 18px;
  font-weight: 800
}

.fullHeader .type {
  font-size: 12px;
  color: #cbd5e1
}

.section {
  margin-top: 12px
}

.section h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #9aa0a6
}

.list {
  display: grid;
  gap: 6px
}

.abilityRow {
  display: grid;
  gap: 4px
}

.metaRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px
}

/* Toast & Fatal */
.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  background: #151622;
  border: 1px solid var(--edge);
  padding: 12px 20px;
  border-radius: 12px;
  color: #cbd5e1;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 1001;
  backdrop-filter: blur(8px);
}

.toast[data-on="true"] {
  opacity: 1
}

.fatal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(8, 10, 16, .9);
  z-index: 999;
  color: #fff;
  padding: 24px;
  text-align: center
}

.fatal.on {
  display: grid
}

.fatal .box {
  max-width: 560px;
  border: 1px solid var(--edge);
  background: #0f121b;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .4)
}

/* ================= SHOP (Full Page) ================= */
.shop {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 900;
  background: linear-gradient(282deg, rgba(207, 207, 207, 1) 1.26%, rgb(247, 247, 247) 17.65%, rgb(234, 234, 234) 33.61%, rgb(213, 213, 213) 47.9%, rgba(247, 247, 247, 1) 71.01%),
    linear-gradient(210deg, rgba(251, 115, 233, 0.10), rgba(149, 255, 204, 0.10));
  backdrop-filter: blur(10px) saturate(1.05);
  color: var(--ink);
}

.shop.on {
  display: block;
}

.shopWrap {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  padding: 12px;
  gap: 12px;
}

.shopBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--edge);
  background: #0f121b;
  border-radius: 2px;
}

.shopTabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shopClose {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 2px;
  border: 1px solid var(--edge);
  background: #161720;
  color: #cbd5e1;
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.shopBody {
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.gridShop {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-bottom: 20vh;
}

@media (min-width:760px) {
  .gridShop {
    grid-template-columns: repeat(4, 1fr);
  }
}

.buyBtn {
  border-radius: 10px;
  border: 0px solid #ebebeb;
  background: linear-gradient(316deg, #cc2fe1, rgb(215, 195, 239) 37.82%, rgb(192, 235, 218) 64.71%, #00962f);
  color: #1d1d1d;
  font-weight: 800;
  padding: 6px 12px;
  font-size: 20px;
  width: 100%;
  cursor: pointer;
}

.getMoreWrap {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.getMoreBtn {
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  cursor: pointer;
}

/* Big "Get more" as a card */
.mcard.getMoreCard .getMorePad {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--edge);
  background: radial-gradient(520px 260px at 50% -60px, #1a1b22 0%, #0e0f15 60%);
}

.getMoreBigBtn {
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 900;
  border: 1px solid #334155;
  background: #0f121b;
  color: #e2e8f0;
  font-size: 18px;
  cursor: pointer;
}

.getMoreHint {
  margin-top: 6px;
  color: #cbd5e1;
  opacity: .9;
  font-size: 12px;
}

/* ===== Crafting Overlay & Animations ===== */
.craftOverlay {
  position: fixed;
  pointer-events: none;
  z-index: 70;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
}

.craftOverlay .layer {
  position: absolute;
  will-change: transform, opacity, left, top;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .45));
}

.craftOverlay .layer .thumb,
.craftOverlay .layer .tagbox {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  border: 1px solid var(--edge);
  overflow: hidden;
  display: block;
  background: #0a0b10;
}

.craftOverlay .layer.top {
  z-index: 2;
}

.craftOverlay .layer.bottom {
  z-index: 1;
}

.craftOverlay .orbitA {
  animation: craftOrbitA 1.6s ease-in-out infinite alternate;
}

.craftOverlay .orbitB {
  animation: craftOrbitB 1.6s ease-in-out infinite alternate;
}

@keyframes craftOrbitA {
  0% {
    transform: translate(-6px, -2px) rotate(0.001deg);
  }

  50% {
    transform: translate(6px, 4px) rotate(0.001deg);
  }

  100% {
    transform: translate(-4px, 6px) rotate(0.001deg);
  }
}

@keyframes craftOrbitB {
  0% {
    transform: translate(5px, -4px) rotate(0.001deg);
  }

  50% {
    transform: translate(-5px, 4px) rotate(0.001deg);
  }

  100% {
    transform: translate(3px, -6px) rotate(0.001deg);
  }
}

/* Runtime CSS hook for spawn reservation */
.mcard.spawningHide {
  visibility: hidden;
}

/* ===== Recipe strip in full card ===== */
.recipeStrip {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
}

.recipeStrip>* {
  flex: 1 1 0;
  min-width: 0;
}

.recipeStrip .mcard {
  position: relative;
  border-radius: 2px;
}

.recipeStrip .mcard .thumb {
  filter: sepia(1) saturate(.9) contrast(1.05);
  /* sepia look */
}

.recipeCard .mcap {
  padding: 6px;
}

.recipeCard strong {
  font-size: 12px;
}

.recipeBadge,
.typeBadge,
.phaseBadge {
  position: absolute;
  left: 6px;
  top: 6px;
  width: fit-content;
  min-width: 22px;
  padding-left: 6px;
  padding-right: 6px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 12px;
  color: #e8eaed;
  background: #0f121b;
  border: 1px solid var(--edge);
  z-index: 2;
  text-transform: uppercase;
}

/* Larger pill variant for milestone on hero header */
.phaseBadge.big {
  height: 24px;
  min-width: 28px;
  padding: 0 8px;
  border-radius: 999px;
  left: 8px;
  top: 8px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
}

/* Ghost next-step card in recipe strip */
.recipeCard.ghostAction {
  border: 1px dashed var(--edge);
  background: #0d0f16;
  opacity: .9;
  cursor: pointer;
}

.recipeCard.ghostAction .mcap {
  padding: 10px;
}

.recipeCard.ghostAction .hintLine {
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  color: #cbd5e1;
}

.recipeCard.ghostAction .hintLine strong {
  color: #e8eaed;
}

.recipeCard.ghostAction:hover {
  filter: brightness(1.05);
}

.recipeLink {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

/* Shop focus flash when jumping from recipe */
@keyframes flashFocus {
  0% {
    box-shadow: 0 0 0 0 rgba(119, 255, 163, 0.00);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(119, 255, 163, 0.35);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(119, 255, 163, 0.00);
  }
}

.gridShop .mcard.flash {
  animation: flashFocus 1.2s ease-in-out 2;
}

/* Discoverer Badge - positioned in modal header between share and close buttons */
.panel .discoverer-badge {
  position: absolute;
  top: -44px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 8px 16px;
  margin: 0;
  font-size: 12px;
  text-align: center;
  background: #FFFFFF;
  border: 1px solid var(--edge);
  border-radius: 20px;
  color: var(--muted);
  white-space: nowrap;
}

.panel .discoverer-badge.you {
  background: linear-gradient(135deg, rgba(120, 80, 180, 0.15), rgba(80, 40, 120, 0.15));
  border-color: rgba(120, 80, 180, 0.4);
  color: #7c3aed;
  font-weight: 600;
}

/* Discoverer badge as link */
.panel a.discoverer-badge {
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.panel a.discoverer-badge:hover {
  background: #f0f0f0;
  transform: translateX(-50%) scale(1.02);
}

/* ================= PROFILE PAGE ================= */
.profile-hero {
  text-align: center;
  padding: 40px 24px;
  background: #FFFFFF;
  min-height: 60vh;
}

.profile-name {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--font-heading);
}

.profile-stat {
  color: var(--muted);
  margin: 0 0 32px;
  font-size: 14px;
}

.profile-fits {
  max-width: 900px;
  margin: 0 auto 32px;
}

.profile-loading,
.profile-error {
  padding: 60px 24px;
  color: var(--muted);
}

.profile-error h2 {
  margin: 0 0 12px;
  color: var(--ink);
}

.profile-error p {
  margin: 0 0 24px;
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--ink);
}

.no-fits {
  color: var(--muted);
  grid-column: 1 / -1;
  padding: 40px;
}


/* ================= WELCOME HERO (Unlogged Experience) ================= */
.welcome-hero {
  text-align: center;
  padding: 60px 24px 40px;
  background: #FFFFFF;
  border-radius: 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--edge);
  animation: fadeInUp 0.6s ease-out;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.welcome-title {
  font-size: 36px;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--ink);
  font-family: var(--font-heading);
  letter-spacing: -0.03em;
}

.welcome-tagline {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 32px;
  line-height: 1.6;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  font-family: var(--font-body);
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.welcome-features .feature {
  background: #F8F8F8;
  border: 1px solid var(--edge);
  border-radius: 2px;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  font-family: var(--font-body);
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 2px;
  background: var(--ink);
  color: #FFFFFF;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cta-btn:hover {
  transform: translateY(-2px);
  background: var(--acc);
  color: #FFFFFF;
}

.cta-btn:active {
  transform: translateY(0);
}

/* Preview section for featured fits */
.preview-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--edge);
}

.preview-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 16px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.preview-card {
  aspect-ratio: 1;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--edge);
  background: #FFFFFF;
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
}

.preview-card:nth-child(1) {
  animation-delay: 0.1s;
}

.preview-card:nth-child(2) {
  animation-delay: 0.2s;
}

.preview-card:nth-child(3) {
  animation-delay: 0.3s;
}

.preview-card:nth-child(4) {
  animation-delay: 0.4s;
}

.preview-card:nth-child(5) {
  animation-delay: 0.5s;
}

.preview-card:nth-child(6) {
  animation-delay: 0.6s;
}

.preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-card .placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: #F4F4F4;
  font-size: 24px;
}

/* Unlogged tray state */
.sheet.unlogged {
  background: linear-gradient(210deg, rgba(100, 80, 160, 0.95), rgba(60, 40, 100, 0.95));
}

.unlogged-tray-content {
  text-align: center;
  padding: 20px;
  color: #e5e7eb;
}

.unlogged-tray-content h3 {
  font-size: 16px;
  margin: 0 0 8px;
  font-weight: 800;
}

.unlogged-tray-content p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 16px;
}

.browse-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.browse-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Login required shop button */
.buyBtn.loginRequired {
  background: linear-gradient(135deg, #5865F2, #7289DA);
  color: #fff;
  font-size: 14px;
}

.buyBtn.loginRequired:hover {
  filter: brightness(1.1);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 4px 20px rgba(88, 101, 242, 0.4);
  }

  50% {
    box-shadow: 0 4px 30px rgba(88, 101, 242, 0.6);
  }
}

.cta-btn.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ================= SHOWCASE FIT (Unlogged Experience) ================= */
.showcase-section {
  margin-bottom: 24px;
}

.showcase-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 16px;
}

.showcase-fit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.showcase-image {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  border-radius: 0;
  overflow: hidden;
  border: 0;
  background: var(--card);
  animation: fadeInUp 0.6s ease-out;
}

.showcase-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.showcase-image .placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1a1b22, #0e0f15);
  font-size: 48px;
}

.showcase-name {
  font-size: 20px;
  font-weight: 800;
  color: #e5e7eb;
  text-align: center;
}

.showcase-recipe {
  width: 100%;
  margin-top: 8px;
}

.showcase-recipe .recipe-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
  text-align: center;
}

.recipe-inspos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.recipe-inspo {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--edge);
  border-radius: 8px;
  font-size: 11px;
  color: #cbd5e1;
  animation: fadeInUp 0.4s ease-out backwards;
}

.recipe-inspo:nth-child(1) {
  animation-delay: 0.1s;
}

.recipe-inspo:nth-child(2) {
  animation-delay: 0.2s;
}

.recipe-inspo:nth-child(3) {
  animation-delay: 0.3s;
}

.recipe-inspo:nth-child(4) {
  animation-delay: 0.4s;
}

.recipe-inspo .inspo-thumb-wrapper {
  width: 14px;
  height: 14px;
}

.recipe-inspo .inspo-icon {
  width: 12px;
  height: 12px;
  font-size: 7px;
}

.recipe-inspo .inspo-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.showcase-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  color: var(--muted);
}

.showcase-loading .placeholder {
  font-size: 48px;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Showcase Grid & Cards (Moved from app.js) */
.showcase-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 40px;
  width: 100%;
  flex: 1;
}

@media (min-width: 768px) {
  .showcase-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.showcase-card {
  background: #FFFFFF;
  border: 1px solid var(--edge);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.showcase-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-color: var(--ink);
}

.showcase-card .showcase-image {
  width: 100%;
  max-width: none;
  aspect-ratio: 3/4;
  background: #F8F8F8;
  position: relative;
}

.showcase-card .showcase-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.showcase-card .showcase-image .placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 48px;
  opacity: 0.5;
}

.showcase-meta {
  padding: 12px;
  text-align: left;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.showcase-name {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 4px;
}

.showcase-card .showcase-recipe {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--edge);
}

/* Altar Animations & Mini Cards */
.mcard.mini {
  /* Explicit sizing instead of scale hack */
  width: 90px;
  flex: 0 0 auto;
  margin: 0;
  font-size: 11px;
}

.mcard.mini .thumb {
  border-radius: 8px;
  /* Tighter radius for mini */
}

/* Ensure mini cards fit nicely in the flex/grid layout */
.altar-slot {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px !important;
  /* Proper gap */
  min-height: 120px !important;
  padding: 10px;
}

.mcard.mini .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(4px);
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.mcard.mini:hover .remove-btn {
  background: var(--bad);
  border-color: var(--bad);
  transform: scale(1.1);
}

@keyframes popOut {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }

  100% {
    transform: scale(0.4);
    opacity: 0;
    filter: blur(4px);
  }
}

@keyframes popIn {
  0% {
    transform: scale(0.4);
    opacity: 0;
    filter: blur(4px);
  }

  60% {
    transform: scale(1.1);
    opacity: 1;
    filter: blur(0);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.anim-out {
  animation: popOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

.anim-in {
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Override existing altar styles for the new card based approach */
.altar-slot .mcard {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.altar-slot .mcard:hover {
  transform: translateY(-2px);
  z-index: 5;
  filter: brightness(1.1);
}

/* Share button aligned with close button */
.panel .modalShare {
  position: absolute;
  top: -48px;
  left: 0;
  z-index: 10;
  background: #FFFFFF;
  border: 1px solid var(--edge);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 16px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.panel .modalShare:hover {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

/* ================= GALA PORTRAIT FEATURE ================= */

/* Gala button in closet cards */
.gala-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-heading);
  background: linear-gradient(135deg, #c77dff, #9d4edd);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  /* Anchor tag reset */
  text-decoration: none;
}

.gala-btn:hover {
  background: linear-gradient(135deg, #e0aaff, #c77dff);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(157, 78, 221, 0.4);
}

.gala-row {
  justify-content: flex-start;
}

/* Gala modal styling */
.gala-modal {
  padding: 32px;
  max-width: 500px;
  margin: 0 auto;
}

.gala-modal h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--ink);
  font-family: var(--font-heading);
}

.gala-desc {
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.6;
}

.gala-section {
  margin-bottom: 24px;
}

.gala-section h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ink);
}

.gala-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

.gala-portraits-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.gala-portrait-option {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--edge);
  transition: all 0.2s ease;
}

.gala-portrait-option:hover {
  border-color: var(--acc);
  transform: scale(1.05);
}

.gala-portrait-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gala-divider {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 20px 0;
  position: relative;
}

.gala-divider::before,
.gala-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--edge);
}

.gala-divider::before {
  left: 0;
}

.gala-divider::after {
  right: 0;
}

.gala-upload-input {
  display: none;
}

.gala-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  background: var(--ink);
  color: #fff;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gala-upload-btn:hover {
  background: var(--acc);
}

.gala-generating {
  text-align: center;
  padding: 40px 0;
}

.gala-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--edge);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.gala-generating p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.gala-result {
  text-align: center;
  padding: 20px 0;
}

.gala-result img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--edge);
  margin-bottom: 16px;
}

.gala-success {
  color: var(--ok);
  font-weight: 700;
  font-size: 14px;
  margin: 0;
}

.gala-error {
  text-align: center;
  padding: 24px 0;
}

.gala-error-msg {
  color: var(--bad);
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 8px;
}

.gala-privacy {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--edge);
}

.gala-privacy a {
  color: var(--muted);
  text-decoration: underline;
}

.gala-modal h2 {
  font-family: var(--font-heading);
  text-transform: uppercase;
  font-size: 24px;
  line-height: 1;
  margin-bottom: 0;
}

.gala-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.gala-header-card {
  height: 90px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gala-header-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* At the Gala section in detail view */
.gala-section-detail {
  background: linear-gradient(135deg, rgba(199, 125, 255, 0.1), rgba(157, 78, 221, 0.1));
  border: 1px solid rgba(157, 78, 221, 0.2);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.gala-section-detail h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #7c3aed;
}

.gala-section-detail .gala-thumbs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.gala-section-detail .gala-thumb {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid rgba(157, 78, 221, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gala-section-detail .gala-thumb:hover {
  transform: scale(1.1);
  border-color: #7c3aed;
}

.gala-section-detail .gala-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Gala Modal Improvements */
.gala-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.gala-option {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  background: var(--surface-2);
}

/* removed hover transform */

.gala-option.selected {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.gala-option.ghost {
  border: 2px dashed rgba(124, 58, 237, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.05);
}

.gala-option.ghost:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: #7c3aed;
}

.gala-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gala-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: none;
  padding: 0;
}


.gala-delete-btn:hover {
  transform: scale(1.15);
  background: var(--bad);
}

.gala-delete-btn.confirm {
  width: auto;
  height: auto;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--acc);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.02em;
  transform: none;
  box-shadow: none;
}

.gala-plus {
  font-size: 24px;
  margin-bottom: 4px;
}

.gala-upload-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.gala-create-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #7c3aed, #9d4edd);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  transition: all 0.2s ease;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gala-create-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  background: var(--surface-3);
  color: var(--muted);
}

.gala-create-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

/* Gala Credit Warning/Info */
.gala-credit-warning {
  margin: 12px 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, #ff6b6b22 0%, #ee5a3522 100%);
  border: 1px solid #ff6b6b55;
  border-radius: 8px;
  color: #d63031;
  font-size: 13px;
  text-align: center;
}

.gala-credit-info {
  margin: 12px 0;
  padding: 10px 14px;
  background: linear-gradient(135deg, #667eea22 0%, #764ba222 100%);
  border: 1px solid #667eea44;
  border-radius: 8px;
  color: #5f27cd;
  font-size: 12px;
  text-align: center;
}

/* Buy Credits Button in Gala */
.gala-buy-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: #fff !important;
  cursor: pointer !important;
  opacity: 1 !important;
}

.gala-buy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

/* Gala Lightbox Gallery */
.gala-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: gala-lb-fade-in 0.2s ease;
}

@keyframes gala-lb-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.gala-lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.gala-lb-close:hover {
  opacity: 1;
}

.gala-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 48px;
  cursor: pointer;
  padding: 16px 24px;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
  border-radius: 8px;
}

.gala-lb-nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

.gala-lb-prev {
  left: 16px;
}

.gala-lb-next {
  right: 16px;
}

.gala-lb-content {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gala-lb-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.gala-lb-counter {
  color: white;
  font-size: 14px;
  margin-top: 12px;
  opacity: 0.7;
}

.gala-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #7c3aed, #9d4edd);
  color: white;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  /* Anchor tag reset */
  text-decoration: none;
}

.gala-cta-btn:hover {
  transform: translateY(-2px);
}

/* Gala portrait overlay on closet cards */
.gala-overlay {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 5;
}

.gala-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}